package cn.eastseven;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.redis.core.StringRedisTemplate;

public class AppSender {
	private static final Logger log = Logger.getLogger(AppSender.class);

	public static void main(String[] args) {
		log.info("发送端");
		ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);

		log.info(ctx);
//		MessageSender sender = ctx.getBean(MessageSender.class);
//		int index = 1;
//		while(true) {
//			sender.send("Hello JMS ... " + index);
//			index++;
//		}
		
		StringRedisTemplate template = ctx.getBean(StringRedisTemplate.class);
		template.convertAndSend("chat", "Hello from Redis!");
		log.info("done...");
		System.exit(0);
	}
}
